# -*- encoding=utf8 -*-
"""
RedFlag-TC000061   拍摄48S自动进入装饰页
拍摄60秒自动进入装饰页场景
拍摄180秒自动进入装饰页场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("--------------------------------拍摄60秒自动进入装饰页场景--------------------------------------")
"""
进入相机拍摄
点击拍摄按钮
等待
断言
"""

shooter.enter_photograph()
shooter.click_element(shooting_page_60_seconds)
shooter.click_element(shooting_button)
shooter.wait_for_element_appearance(decoration_page_return_button, 60)
shooter.assert_element_exists(decoration_page_release_video, "断言失败，并未自动进入装饰页")

# 关闭应用
stop_app(UGC_package_name)


log("--------------------------------拍摄3min自动进入装饰页场景--------------------------------------")
"""
进入相机拍摄
点击拍摄按钮
等待
断言
"""

shooter.click_element(UGC_icon)
sleep(5.0)
shooter.click_element(UGC_entrance)
shooter.click_element(create_photograph)
sleep(2.0)
shooter.click_element(shooting_page_3_min)
shooter.click_element(shooting_button)
shooter.wait_for_element_appearance(poco("cn.migu.video.clip.walle:id/clip_comm_title_left_btn"), 185)
shooter.assert_element_exists(set_video_ringtone, "断言失败，并未自动进入装饰页")

# 关闭应用
stop_app(UGC_package_name)